﻿using System;
using SydEnergiPrototype.Model;

namespace SydEnergiPrototype.Logic
{
    public class ReturnResult
    {
        public Cabinets Result { get; private set; }
        public IEntry Parameter { get; private set; }

        private readonly Action<ReturnResult> _callback; 

        public ReturnResult(Action<ReturnResult> callback)
        {
            _callback = callback;
        }

        public ReturnResult(Action<ReturnResult> callback, IEntry parameter):this(callback)
        {
            if(parameter == null)
                throw new ArgumentNullException("parameter");
            Parameter = parameter;
        }

        public void Notify(Cabinets result)
        {
            Result = result;
            if (_callback != null)
                _callback(this);
        }
    }
}
